﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Dos.Model;

public partial class acgmx_Index : PageBase
{
    public DataTable dt;
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable tmp = DBHelper.GetDataTable("select * from temple_contents where title = '寺院介绍'");
        if (tmp != null && tmp.Rows.Count > 0)
            dt = tmp;

        if (IsPostBack)
        {
            if (dt != null && tmp.Rows.Count > 0)
            {
                temple_Contents c = ManageBase<temple_Contents>.Get(int.Parse(dt.Rows[0]["ID"].ToString()));
                c.Info = Request.Form["txtinfo"];
                ManageBase<temple_Contents>.Set(c);
                AlertRedirect("编辑成功!", "index.aspx");
            }
            else
            {
                temple_Contents c = new temple_Contents();
                c.Title = "寺院介绍";
                c.CategoryID = 0;
                c.Info = Request.Form["txtinfo"];
                ManageBase<temple_Contents>.Add(c);
                AlertRedirect("编辑成功!", "index.aspx");
            }
        }
    }
}